<template>
	<div class="table"  style="margin-top:10px;">
		<el-table :data="resData.data" :emptyText="resData.msg?resData.msg:'暂无数据'" v-loading="loading" border :max-height="tableHeight" highlight-current-row style="width: 100%;">
			<el-table-column type="index" label="序号" width="60"></el-table-column>
			<el-table-column prop="UserNo" label="学号" width="110"></el-table-column>
			<el-table-column prop="UserName" label="姓名" width="130"></el-table-column>
			<el-table-column prop="TypeName" label="学院/班级" min-width="140">
				<template slot-scope="scope">
					{{ scope.row.DepartName }} / {{ scope.row.ClassName }}
				</template>
			</el-table-column>
			<el-table-column prop="ActivityTypePrizeTitle" label="奖项" min-width="100">
				<template slot-scope="scope">
					{{ scope.row.ActivityTypePrizeTitle }}{{ scope.row.PrizeTitle?' | '+scope.row.PrizeTitle:'' }}
				</template>
			</el-table-column>
			<el-table-column prop="Score" label="分值" min-width="100">
				<template slot-scope="scope">
					{{ scope.row.Score ? scope.row.Score : '暂无' }}
				</template>
			</el-table-column>
			
			<el-table-column label="操作" width="90">
				<template slot-scope="scope">
					<oprateBtn title="删除" v-if="$route.query.type!=2" icon="icon-delete" color="red" @tap="deleteList(scope.row)"></oprateBtn>
				</template>
			</el-table-column>
		</el-table>
		<el-pagination
			@size-change="handleSizeChange"
			@current-change="handleCurrentChange"
			:current-page="pagination.currentPage"
			:page-sizes="pagination.pageSizeOptions"
			:page-size="pagination.pageSize"
			layout="total, sizes, prev, pager, next, jumper"
			:total="pagination.total"
		></el-pagination>
	</div>
</template>

<script>
import Func from '@/utils/func';
import { ManageActivityFlowDoGetMemberPrizePageList,ManageActivityFlowDoDeleteMemberPrize } from '@/api/follow';
export default {
	components: {
	},
	data() {
		return {
			resData:{
				data:[],
				msg:'暂无数据'
			},
			form: this.$form.createForm(this, {
				name: 'advanced_search'
			}),
			pagination: {
				currentPage: 1,
				pageSize: this.global.pageSize,
				pageSizeOptions: this.global.pageSizeOptions, // 每页中显示的数据
				showTotal: total => `共有 ${total} 条数据` // 分页中显示总的数据
			},
			addIf: false,
			text: {},
			visible: false,
			confirmLoading: false,
			itemId: '',
			departmentList: [],
			worklist: [],
			loading: false,
			values: {},
			userList:[],
			ActivityTypePrizeList:[],
			tableHeight: parseFloat(window.innerHeight - 160),
			exportconIf:false,
			importText:{},
			ActivityTypePrizeTypeList:[]
		};
	},
	computed: {},
	created() {
		this.getList();
	},
	mounted() {},
	methods: {
		handleSearch(e) {
			e.preventDefault();
			this.form.validateFields((error, values) => {
				this.pagination.currentPage = 1;
				this.values = values;
				this.getList();
			});
		},
		handleReset() {
			this.form.resetFields();
			this.values = {};
			this.getList();
		},
		handleSizeChange(val) {
			this.pagination.pageSize = val;
			this.getList();
		},
		handleCurrentChange(val) {
			this.pagination.currentPage = val;
			this.getList();
		},
		async getList() {
			this.loading = true;
			let data = {};
			data = { ...this.values }
			data.pageIndex = this.pagination.currentPage;
			data.pageSize = this.pagination.pageSize;
			data.id = this.$route.query.ID
			let res = await ManageActivityFlowDoGetMemberPrizePageList(data);
			this.loading = false;
			this.resData = res.data;
			const pagination = { ...this.pagination };
			pagination.total = res.data.pageInfo?res.data.pageInfo.TotalItemCount:0;
			this.pagination = pagination;
		},
		deleteList(text) {
			let that = this;
			this.$confirm({
				title: '提示',
				content: `您确定删除该数据吗？`,
				okText: '确认',
				cancelText: '取消',
				async onOk() {
					let data = {};
					data.memberPrizeID = text.ID;
					let res = await ManageActivityFlowDoDeleteMemberPrize(data);
					if (res.data.code == 0) {
						that.getList();
						that.$message.success(res.data.msg);
					} else {
						that.$message.error(res.data.msg);
					}
				}
			});
		},
		seeList(item) {
		},
		setFlow(text) {
			let path = '';
			path = 'ApplyActivityFlow';
			this.$router.push({
				name: path,
				query: {
					clubTypeID: text.ID
				}
			});
		},
		handleCancel(e) {
			this.visible = false;
		},
		closeFun(data) {
			this.addIf = false;
			this.exportconIf = false
			if(data==1){
				this.getList();
			}
		}
	}
};
</script>

<style lang="less" scoped>
.home-form /deep/.ant-form-item {
	display: flex;
	margin-bottom: 10px !important;
}
.home-form /deep/.ant-form-item-label {
	width: 80px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	text-align: right;
}
.home-form /deep/.ant-form-item-control-wrapper {
	flex: 1;
}
/deep/.el-table th.is-leaf {
	background: #fafafa;
}
/deep/.el-table td,
/deep/.el-table th {
	padding: 5px;
}
.option {
	margin-top: 10px;
	margin-bottom: 20px;
	overflow: hidden;
}
.option .btn {
	height: 36px;
	line-height: 36px;
	padding: 0 10px;
	float: left;
	background: #1890ff;
	color: #fff;
	margin-right: 10px;
	border-radius: 3px;
	cursor: pointer;
	border: none;
}
.foot {
	text-align: center;
	margin-top: 100px;
}
.el-pagination {
	margin-top: 10px;
}
</style>
